package nl.maarten.docenthelp.manager;

import nl.maarten.docenthelp.data.Database;
import nl.maarten.docenthelp.entity.User;

public class LoginManager
{
	private static LoginManager instanceManager;
	
	private User currentUser = null;
	
	private Database db;
	
	public static LoginManager getInstance()
	{
		if(instanceManager == null)
		{
			instanceManager = new LoginManager();
		}
		
		return instanceManager; 
	}
	
	public User login(String username, String password)
	{
		currentUser = db.checkLogin(username, password);
		
		return currentUser;
	}
	
	public User getCurrentUser()
	{
		return currentUser;		
	}
	
	private LoginManager()
	{
		db = Database.getInstance();
	}
}
